package com.china.jzf.spingboot_aop.Controller;

import com.china.jzf.spingboot_aop.MoStudent;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.UUID;

@RestController
@RequestMapping("/")
public class UserController {

    @PostMapping("/addUser")
    public ResponseEntity<MoStudent> addUser(@RequestBody MoStudent moStudent) throws Exception {
        moStudent.setNumber(UUID.randomUUID().toString());
//        throw new Exception("错误了");
        return new ResponseEntity<>(moStudent, HttpStatus.OK);
    }

    @RequestMapping(value = "/queryUser",method = RequestMethod.GET)
    public ResponseEntity<MoStudent> queryUser(int id) throws Exception {
        MoStudent moStudent=new MoStudent();
        moStudent.setNumber(UUID.randomUUID().toString());
//        throw new Exception("错误了");
        return new ResponseEntity<>(moStudent, HttpStatus.OK);
    }
}
